//package jp.sourceforge.talisman.mds.distance;
//
///*
// * $Id: CityBlockItemDistanceCalculatorTest.java,v 1.1 2009/09/12 05:06:09 weiwei Exp $
// */
//
//import jp.sourceforge.talisman.mds.Item;
//import jp.sourceforge.talisman.mds.distance.CityBlockItemDistanceCalculator;
//import jp.sourceforge.talisman.mds.distance.DistanceCalculatorFactory;
//import jp.sourceforge.talisman.mds.distance.ItemDistanceAlgorithm;
//import jp.sourceforge.talisman.mds.distance.ItemDistanceCalculator;
//
//import org.junit.Assert;
//import org.junit.Before;
//import org.junit.Test;
//
///**
// * 
// * @author Haruaki Tamada
// * @version $Revision: 1.1 $ 
// */
//public class CityBlockItemDistanceCalculatorTest{
//    private ItemDistanceCalculator distance;
//    private Item item1;
//    private Item item2;
//
//    @Before
//    public void initialize() throws Exception{
//        DistanceCalculatorFactory factory = DistanceCalculatorFactory.getInstance();
//        distance = factory.getItemDistanceCalculator(ItemDistanceAlgorithm.CITY_BLOCK_DISTANCE);
//
//        item1 = new Item("item1", new double[] { 0, 0, 0, });
//        item2 = new Item("item2", new double[] { 3, 4, 5, 6, });
//    }
//
//    @Test
//    public void testBasic(){
//        Assert.assertEquals(ItemDistanceAlgorithm.CITY_BLOCK_DISTANCE, distance.getAlgorithm());
//
//        Assert.assertTrue(distance instanceof CityBlockItemDistanceCalculator);
//
//        Assert.assertEquals(12d, distance.calculate(item1, item2), 1E-6);
//        Assert.assertEquals( 7d, distance.calculate(item1, item2, 2), 1E-6);
//        Assert.assertEquals(12d, distance.calculate(item2, item1), 1E-6);
//        Assert.assertEquals( 7d, distance.calculate(item2, item1, 2), 1E-6);
//    }
//
//    @Test(expected=IllegalArgumentException.class)
//    public void testException(){
//        ((CityBlockItemDistanceCalculator)distance).calculate(new double[] { 1, }, new double[] { 2, 3, });
//    }
//
//    @Test
//    public void testAbstractItemDistanceMethod(){
//        item2 = new Item("item2", new double[] { 3, 4,});
//
//        Assert.assertTrue(distance instanceof CityBlockItemDistanceCalculator);
//
//        Assert.assertEquals( 7d, distance.calculate(item1, item2), 1E-6);
//    }
//}
